package edu.aysf.service.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

// goods-service 需要在hosts配置
@FeignClient(name = "goods-service",url = "http://localhost:8082")
public interface GoodsServiceFeign {
    // 更新商品库存
    @RequestMapping("/goods/update")
    int updateGoods(@RequestBody Map<String, Object> map);

    // 查询库存数量
    // 如果没有这个参数@RequestParam，feign调用会失败，
    // 必须通过body传参而不是问号传参
    @RequestMapping("/goods/select/count")
    int selectCount(@RequestBody Map<String, Object> map);

    // 查询商品单价
    @RequestMapping("/goods/select/price")
    Float selectGoodsPrice(@RequestBody Map<String,Object> map);
}
